import request from '@/utils/request'
import type {
  ItrademarkListResponse,
  IDataForm,
  ItrademarkForm,
  ItrademarkAddResponse,
} from './type'

enum API {
  // 获取品牌列表
  GET_TRADEMARK_LIST = '/admin/product/baseTrademark',
  // 添加品牌
  ADD_TRADEMARK = '/admin/product/baseTrademark/save',
  // 更新品牌
  UPDATE_TRADEMARK = '/admin/product/baseTrademark/update',
  // 删除品牌
  DELETE_TRADEMARK = '/admin/product/baseTrademark/remove/',
}
export const getTrademarkList = (data: IDataForm) =>
  request.get<any, ItrademarkListResponse>(
    `${API.GET_TRADEMARK_LIST}/${data.page}/${data.limit}`,
  )

export const addTrademark = (data: ItrademarkForm) =>
  request.post<any, ItrademarkAddResponse>(API.ADD_TRADEMARK, data)

export const undateTrademark = (data: ItrademarkForm) =>
  request.put<any, ItrademarkAddResponse>(API.UPDATE_TRADEMARK, data)

export const deleteTrademark = (id: number | string) =>
  request.delete<any, ItrademarkAddResponse>(API.DELETE_TRADEMARK + id)
